package com.yupi.yu_picture.api.imageSearch;


import com.yupi.yu_picture.api.imageSearch.model.ImageSearchResult;
import com.yupi.yu_picture.api.imageSearch.sub.GetImageFirstUrlApi;
import com.yupi.yu_picture.api.imageSearch.sub.GetImageList;
import com.yupi.yu_picture.api.imageSearch.sub.GetImagePageUrlApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
public class ImageSearchApiFacade {
    public static List<ImageSearchResult> searchImage(String url){
        String pageUrl = GetImagePageUrlApi.getImagePageUrl(url);
        String imageFirstUrl = GetImageFirstUrlApi.getImageFirstUrl(pageUrl);
        List<ImageSearchResult> imageList = GetImageList.getImageList(imageFirstUrl);
        return imageList;

        /**
         * 通过用户上传的图片路径，通过调用百度识图的接口，得到百度搜索后的图片结果页面路径
         * 再通过图片页面路径得到 所有相似图片所在的路径
         * 再从所在路径得到所有图片的缩略图和来源路径
         */

    }

}
